package jykim;

public class Diamond {

	private int dot_len;
	
	public Diamond(){
		this(9);
	}
	
	public Diamond(int n){
		this.init(n);
	}
	
	public void init(int n){
		dot_len = n;
	}
	
	public void dotPrint(){
		rightPrint();
		leftPrint();
	}
	
	public void rightPrint(){
		for (int i = 1; i <= dot_len; i+=2) {
			
			for (int j = 0; j < (dot_len-i)/2; j++) {
				System.out.print(" ");
			}
			
			for (int k = 0; k < i; k++) {
				System.out.print("*");
			}
			System.out.println();
		}
	}
	
	public void leftPrint(){
		for (int i = dot_len-2; i > 0; i-=2) {
			
			for (int j = 0; j < (dot_len-i)/2; j++) {
				System.out.print(" ");
			}
			
			for (int k = 0; k < i; k++) {
				System.out.print("*");
			}
			System.out.println();
	
		}
	}
}
